<form name="customer-modify" class="form-horizontal form-row-seperated form-condensed validator-dialog form-ajax" action="<?=url('customer/modify/' . $customer->customer_id)?>" method="post">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
        <h4 class="modal-title">
            <i class="fa fa-pencil"></i>
            <?=__('Customer Modify')?>
        </h4>
    </div>
    <div class="modal-body form">
        <input type="hidden" name="customer_id" value="<?=$customer->customer_id?>" />
        <div class="form-body">
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <span class="required">*</span>
                    <?=__('Nickname')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="nickname" class="form-control" value="<?=$customer->nickname?>" data-required="<?=__('Nickname is required')?>" />
                </div>
                <label class="col-sm-2 control-label">
                    <span class="required">*</span>
                    <?=__('Customer Type')?>
                </label>
                <div class="col-sm-4">
                    <select name="type_id" class="form-control" data-min="1,<?=__('Please select customer type')?>">
                        <option value="0"><?=__('Select...')?></option>
                        <? foreach ($types as $t): ?>
                        <option value="<?=$t['type_id']?>" <?=on($customer->type_id == $t['type_id'], 'selected')?>>
                            <?=OaCustomerTypes::getName($t['type_id'])?>
                        </option>
                        <? endforeach; ?>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <?=__('First Name')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="first_name" class="form-control" value="<?=$details->first_name?>" />
                </div>
                <label class="col-sm-2 control-label">
                    <?=__('Last Name')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="last_name" class="form-control" value="<?=$details->last_name?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <span class="required">*</span>
                    Email
                </label>
                <div class="col-sm-4">
                    <input type="text" name="email" class="form-control" value="<?=$customer->email?>" data-required="<?=__('Email is required')?>" data-email="<?=__('Invalid email address')?>" />
                </div>
                <label class="col-sm-2 control-label">
                    UID
                </label>
                <div class="col-sm-4">
                    <input type="text" name="web_uid" class="form-control" value="<?=on($customer->web_uid, $customer->web_uid)?>" data-number="<?=__('Invalid web uid')?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <span class="required">*</span>
                    <?=__('Gender')?>
                </label>
                <div class="col-sm-4">
                    <label class="radio-inline">
                        <input type="radio" name="gender" value="0" <?=on($details->gender == 0, 'checked')?> />
                        <?=__('Unknown')?>
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="gender" value="1" <?=on($details->gender == 1, 'checked')?> />
                        <?=__('Female')?>
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="gender" value="2" <?=on($details->gender == 2, 'checked')?> />
                        <?=__('Male')?>
                    </label>
                </div>
                <label class="col-sm-2 control-label">
                    <span class="required">*</span>
                    <?=__('Register At')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="reg_time" class="form-control" value="<?=on($customer->reg_time, date('Y-m-d H:i:s', $customer->reg_time))?>" data-datetime="<?=__('Invalid time format')?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <?=__('Mobile')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="mobile" class="form-control" value="<?=$customer->mobile?>" data-regex="/^[\d \-]{5,}$/,<?=__('Invalid mobile format')?>" />
                </div>
                <label class="col-sm-2 control-label">
                    <?=__('Phone')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="phone" class="form-control" value="<?=$customer->phone?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    DEMO
                </label>
                <div class="col-sm-4">
                    <input type="text" name="mt4_demo" class="form-control" value="<?=on($customer->mt4_demo, $customer->mt4_demo)?>" data-number="<?=__('Invalid MT4 demo account')?>" />
                </div>
                <label class="col-sm-2 control-label">
                    LIVE
                </label>
                <div class="col-sm-4">
                    <input type="text" name="mt4_live" class="form-control" value="<?=on($customer->mt4_live, $customer->mt4_live)?>" data-number="<?=__('Invalid MT4 live account')?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    IB
                </label>
                <div class="col-sm-4">
                    <input type="text" name="merchant_id" class="form-control" value="<?=on($customer->merchant_id, $customer->merchant_id)?>" data-number="<?=__('Invalid IB account')?>" />
                </div>
                <label class="col-sm-2 control-label">
                    <?=__('Expected IB')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="expected_ib" class="form-control" value="<?=on($details->expected_ib, $details->expected_ib)?>" data-number="<?=__('Invalid IB account')?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <?=__('Country')?>
                </label>
                <div class="col-sm-4">
                    <select name="country_id" class="form-control">
                        <option value="0"><?=__('Select...')?></option>
                        <? foreach ($countries as $country_id): ?>
                        <option value="<?=$country_id?>" <?=on($customer->country_id == $country_id, 'selected')?>>
                            <? $country_en = OaCountries::getName($country_id, 'en-us'); ?>
                            <?=on($lang === 'zh-cn', strtoupper($country_en[0]). ' - ')?><?=__($country_en)?>
                        </option>
                        <? endforeach; ?>
                    </select>
                </div>
                <label class="col-sm-2 control-label">
                    <?=__('Address Detail')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="address" class="form-control" value="<?=$details->address?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <?=__('Industry')?>
                </label>
                <div class="col-sm-4">
                    <select name="industry" class="form-control">
                        <option value="0"><?=__('Select...')?></option>
                        <? foreach (config('customer.industries') as $en => $cn): ?>
                        <option value="<?=$en?>" <?=on($details->industry == $en, 'selected')?>>
                            <?=on($lang === 'zh-cn', $cn, $en)?>
                        </option>
                        <? endforeach; ?>
                    </select>
                </div>
                <label class="col-sm-2 control-label">
                    <?=__('Corporation')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="company" class="form-control" value="<?=$details->company?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <?=__('Balance')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="balance" class="form-control" value="<?=num_format($details->balance, 2)?>" data-number="<?=__('Invalid balance volume')?>" />
                </div>
                <label class="col-sm-2 control-label">
                    <?=__('Golden Level')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="margin_level" class="form-control" value="<?=$details->margin_level?>" data-number="<?=__('Invalid margin level')?>" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <?=__('IM Type')?>
                </label>
                <div class="col-sm-4">
                    <select name="im_type" class="form-control">
                        <option value="0"><?=__('Select...')?></option>
                        <? foreach (config('customer.im') as $en => $cn): ?>
                        <option value="<?=$en?>" <?=on($details->im_type == $en, 'selected')?>>
                            <?=on($lang === 'zh-cn', $cn, $en)?>
                        </option>
                        <? endforeach; ?>
                    </select>
                </div>
                <label class="col-sm-2 control-label">
                    <?=__('IM Account')?>
                </label>
                <div class="col-sm-4">
                    <input type="text" name="im_account" class="form-control" value="<?=$details->im_account?>" />
                </div>
            </div>
            <div class="form-group last">
                <label class="col-sm-2 control-label">
                    <?=__('Description')?>
                </label>
                <div class="col-sm-10">
                    <textarea name="description" class="form-control"><?=$details->description?></textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button type="submit" class="btn btn-primary">
            <i class="fa fa-check"></i>
            <?=__('Submit')?>
        </button>
        <button type="button" class="btn btn-default" data-dismiss="modal">
            <i class="fa fa-times"></i>
            <?=__('Close')?>
        </button>
    </div>
</form>
